From: Jonathan Dieter Date: Mon, 11 Jun 2018 18:48:29 +0000 (+0300) Subject: Add global function to change zck file descriptor X-Git-Tag: archive/raspbian/1.1.9+ds1-1+rpi1~1^2~221 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=89745aaebaaf894507032311c39c8eec48a36b62;p=zchunk.git Add global function to change zck file descriptor Signed-off-by: Jonathan Dieter --- diff --git a/include/zck.h b/include/zck.h index f51f704..e8a517b 100644 --- a/include/zck.h +++ b/include/zck.h @@ -133,6 +133,8 @@ char *zck_get_range_char(zckRange *range) /* Get file descriptor attached to zchunk context */ int zck_get_fd(zckCtx *zck) __attribute__ ((warn_unused_result)); +/* Set file descriptor attached to zchunk context */ +void zck_set_fd(zckCtx *zck, int fd); /* Return number of missing chunks (-1 if error) */ int zck_missing_chunks(zckCtx *zck) diff --git a/src/lib/zck.c b/src/lib/zck.c index ff204a4..a0c3578 100644 --- a/src/lib/zck.c +++ b/src/lib/zck.c @@ -218,6 +218,7 @@ int PUBLIC zck_set_soption(zckCtx *zck, zck_soption option, const char *value, length); return False; } + zck_log(ZCK_LOG_DEBUG, "Setting expected hash to (%s)%s\n", zck_hash_name_from_type(zck->prep_hash_type), data); zck->prep_digest = ascii_checksum_to_bin(data); free(data); @@ -399,3 +400,8 @@ iw_error: int PUBLIC zck_get_fd(zckCtx *zck) { return zck->fd; } + +void PUBLIC zck_set_fd(zckCtx *zck, int fd) { + zck->fd = fd; + return; +}